﻿using Code;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;

namespace Models {
    public class OrderInfos {
        public long Id { get; set; }

        public long UserId { get; set; }

        [DisplayName("订单编号")]
        [List("Order", 0)]
        public string OrderNo { get; set; }

        [Required, Column("ProductName", TypeName = "nvarchar(20)")]
        [DisplayName("商品名称")]
        public string ProductName { get; set; }

        [Required, Column("Receiver", TypeName = "nvarchar(50)")]
        [DisplayName("收货人")]
        public string Receiver { get; set; }

        [Required]
        public int ProvinceId { get; set; }

        [Required]
        public int CityId { get; set; }

        [Required]
        public int AreaId { get; set; }

        [Required, Column("Address", TypeName = "nvarchar(150)")]
        [DisplayName("收货地址")]
        public string Address { get; set; }

        [Required, Column("Phone", TypeName = "varchar(15)")]
        [DisplayName("收货电话")]
        public string Phone { get; set; }

        [DisplayName("数量")]
        public int Count { get; set; }

        [Required, Column("Price", TypeName = "money")]
        public decimal Price { get; set; }

        [DisplayName("金额")]
        [Required, Column("AllPrice", TypeName = "money")]
        public decimal AllPrice { get; set; }

        [DisplayName("购买时间")]
        public DateTime CreateTime { get; set; } = DateTime.Now;

        [Required, Column("Remittance", TypeName = "nvarchar(20)")]
        //[DisplayName("汇款人")]
        public string Remittance { get; set; }

        [Required, Column("RemittanceBank", TypeName = "nvarchar(200)")]
        //[DisplayName("汇款银行")]
        public string RemittanceBank { get; set; }

        [Required, Column("RemittanceNo", TypeName = "varchar(100)")]
        //[DisplayName("汇款银行")]
        public string RemittanceNo { get; set; }

        [Required, Column("RemittanceTime", TypeName = "datetime")]
        //[DisplayName("汇款时间")]
        public DateTime RemittanceTime { get; set; }

        [Required, Column("RemittanceImg", TypeName = "varchar(200)")]
        //[DisplayName("汇款凭证图片")]
        public string RemittanceImg { get; set; }

        [Required, Column("Status", TypeName = "smallint")]
        public OrderStatus Status { get; set; }

        [DisplayName("状态")]
        public string strStatus {
            get {
                return Status.ToString();
            }
        }

        public virtual ICollection<ExpressInfo> ExpressInfos { get; set; }
    }
}
